Skip to content

[python] add bindings for rta::core::Spectrum - #363

Merged
antond-weta merged 1 commit into
AcademySoftwareFoundation:mainfrom
soswow:python-bind-spectrum
Oct 18, 2026
Merged

antond-weta merged 1 commit into
AcademySoftwareFoundation:mainfrom
soswow:python-bind-spectrum

Conversation

@soswow

@soswow soswow commented Oct 18, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Expose rta::core::Spectrum and Spectrum::Shape in the Python bindings, including construction, resampling, integration, and per-element arithmetic.
  • Read and replace channels on SpectralData (data["name"], get, and in), and document the new types in the Python reference.
  • Reject shapes that would make the C++ sample-count cast undefined, and keep Shape unhashable because equality is by value.

The bindings, tests, and docs were drafted in Cursor. A Claude Opus 5.5 review then asked for the shape check, unhashable Shape, operator NotImplemented behavior, and clearer SpectralData containment. Those review comments were applied before opening this PR.

Assisted-by: Cursor / Grok 4.7
Assisted-by: Cursor / Claude Opus 5.5

Test plan

  • PYTHONPATH=build/src/bindings python3.14 -m pytest tests/python
  • python3.14 build_scripts/generate_python_docs.py --module-dir build/src/bindings --check
  • Sphinx HTML build with -E -a -n
  • CI

Made with Cursor

@codecov-commenter

codecov-commenter commented Oct 18, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 91.79%. Comparing base (5c4ba4d) to head (873ebe3).

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #363   +/-   ##
=======================================
  Coverage   91.79%   91.79%           
=======================================
  Files          17       17           
  Lines        3876     3876           
  Branches      582      582           
=======================================
  Hits         3558     3558           
  Misses        318      318           

Continue to review full report in Codecov by Harness.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 5c4ba4d...873ebe3. Read the comment docs.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Expose spectral curves so Python callers can construct, resample, and
combine them, and read channels from loaded spectral data.

Assisted-by: Cursor / Grok 4.7
Assisted-by: Cursor / Claude Opus 5.5
Signed-off-by: Aleksandr Motsjonov <soswow@gmail.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
@antond-weta
antond-weta merged commit 360707c into AcademySoftwareFoundation:main Oct 18, 2026
29 checks passed
@soswow
soswow deleted the python-bind-spectrum branch November 10, 2026 21:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants